import { AIPropertyDescriptor, IField } from "../AIProperty";
import { Field } from "./Field";

export class BooleanField extends Field implements IField {
    create(o: AIPropertyDescriptor, data: any) {
        let p = this._create(o, 'Boolean', data, false);
        return p;
    }
    protected _changeHandle(e: gui.Event) {
        let selected = (e.target as any).selected;
        this.data[this.o.name] = selected;
        this._checkChange();
    }
    protected _setValue(val: any): void {
        let btn = this._panel.getChild("value") as gui.Button;
        btn.selected = val;
    }
}